﻿<div ng-controller="InfoCollection_ListC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">信息列表</h1>
    </div>
    <div class="wrapper-md" style="text-align: right;">
        <div class="panel panel-default">
            <div class="panel-heading">
                <!--<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12" style="float: right">-->
                <button class="btn btn-sm btn-default" ng-click="$state.go('app.InfoCollection_Add')">
                    <i class="fa fa-plus text"></i>
                    <span class="text">添加</span>
                </button>
                <button class="btn btn-sm btn-default" ng-click="$state.go('app.InfoCollection_Detail')">
                    <i class="fa fa-eye text"></i>
                    <span class="text">全部查看</span>
                </button>
                <button class="btn btn-sm btn-default" ng-click="$state.go('app.InfoCollection_View')">
                    <i class="fa fa-eye text"></i>
                    <span class="text">视图报表</span>
                </button>
                <!--</div>-->
                <!--<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 input-group">-->
                <!--<input type="text" class="form-control" placeholder="按名称查找" ng-model="findname">-->
                <!--<span class="input-group-btn">-->
                <!--<button class="btn btn-default" type="button" ng-click="find()">查找</button>-->
                <!--</span>-->
                <!--</div>-->
            </div>
            <div class="table-responsive text-center">
                <table id="example1" class="table table-striped b-t b-light table-bordered">
                    <thead>
                        <tr>

                            <th style="text-align: center;">厂家名称</th>
                            <th style="text-align: center;">类别</th>
                            <th style="text-align: center;">代理商名称</th>
                            <th style="text-align: center;">品类</th>
                            <!--<th style="text-align: center;">价格</th>-->
                            <th style="text-align: center;">库存量</th>
                            <th style="text-align: center;">出货量</th>
                            <th style="text-align: center;">备注</th>
                            <th style="text-align: center;">时间</th>


                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="item in pageData.Data">

                            <td style="width: 15%">{{item.SupplierName}}</td>
                            <td style="width: 10%">{{item.Type}}</td>
                            <td style="width: 15%">{{item.AgentName}}</td>
                            <td style="width: 15%">{{item.Name}}</td>
                            <!--<td style="width: 10%">{{item.Price}}</td>-->
                            <td style="width: 10%">{{item.Stock}}</td>
                            <td style="width: 10%">{{item.Volume}}</td>
                            <td style="width: 10%">{{item.Remark}}</td>
                            <td style="width: 15%">{{item.InfoDate| limitTo:10}}</td>
                        </tr>
                    </tbody>
                </table>
                <div class="panel-heading" my-pagination get-page-data="getData" mypagedata="pageData"></div>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')//非标优惠
.controller("InfoCollection_ListC", function ($scope, $state, $http,toSave) {
    $scope.pageData = {};
    $scope.pageData.Page = 0;

    $scope.pageData.Rows = 20;
    //
    $scope.getData = function (p, r) {
        if (p) {
            p = p < 1 ? 1 : p;
        } else p = 1;
        if (r) {
        } else r = 20;
        toSave.save_pages_lis(p,r);//保存当前页码和条数
        $http({
            url: "../api/InfoCollection/List?name=&type=&dt=&page=" + p + "&rows=" + r,
            method: "GET"
        })
        .then(function (res) {
            $scope.pageData = res.data;
            console.log($scope.pageData);
        }, function (error) {
            if (error) {
                alert("数据获取失败");
            }
        });
    };
    console.log(toSave.get_pages())
    $scope.getData(toSave.get_pages(), $scope.pageData.Rows);

})

</script>
<script src="js/services/toSave.js"></script>
